<?php
	####################################################
	# library import and object instance.              #
	####################################################
	# 커먼 인클루드
	include_once( '../common.php' );

	####################################################
	# request data($_POST AND $_GET FROM $_REQUEST)    #
	####################################################
	# REQUEST(get and post variables)
	$req = Request::clean_request($_REQUEST, FALSE);

	# GET(url variables)

	# POST(form variables)

	# Validation(special case validate)

	####################################################
	# implementation                                   #
	####################################################
	$sec->individual_access();
	$sec->run_cookie_check();

	$pagenation_cfg1 = array(
		'uri'				=> $PHP_SELF,
		'articles_count'	=> 30,
		'req_page'			=> empty($req['p1'])? 0 : $req['p1'],
		'page_size'			=> 6,
		'articles_cnt'		=> $db->getcnts('ggo_cfg_entry_point'),
		'style'				=> Pagenation::$style_white,
		'get'				=> 'p1'
	);
	$epntarr = $epnt->get_entry_points($pagenation_cfg1['req_page'] * $pagenation_cfg1['articles_count'], $pagenation_cfg1['articles_count']);

	$pagenation1 = Pagenation::out($pagenation_cfg1);
	//Nlog::puts('epntarr',$epntarr);

	$packages_keys = $appm->get_packages_key(0, $db->getcnts('ggo_cfg_packages_pref'));

	//Nlog::xmp($gip);
?>
<?php
	# HTML START
	echo $html->custom_header(TITLE);
	echo $tplt->page_construct_javascript();
	echo $html->custom_js("{$JS}common.js");
	echo $html->custom_css("{$CSS}common.css");
	echo $html->custom_body();
?>
	<?php $tplt->app_head($NAVI)?>
	<?php $tplt->tiles_admin_sidebar($NAVI)?>
	<?php $tplt->tiles_admin_contents($pkname, $pname, $pdesc)?>

		<h4>어플리케이션 엔트리 포인트</h4>
		<?php echo NForm::open(NULL, FALSE, "list");?>
			<?php echo NForm::mode('modify')?>
			<table class="tbl" border="0" cellpadding="3" cellspacing="0">
				<colgroup>
					<col width="40" />
					<col width="40" />
					<col width="*" />
					<col width="*" />
					<col width="*" />
					<col width="140" />
				</colgroup>
				<tr>
					<th><input type="checkbox" id="chkctr1" onclick="CheckboxControl.toggle_check_all('#chkctr1','.chk1');"/></th>
					<th>번호</th>
					<th>엔트리 포인트 이름</th>
					<th>리디렉션 할 파일 및 파라미터</th>
					<th>설명</th>
					<th>사용여부</th>
				</tr>
				<?php if($epntarr['has']) foreach($epntarr['res'] as $key=>$val):?>
					<tr>
						<td>
							<input type="checkbox" name="map[<?=$val['uid']?>][uid]" id="chk1_<?=$val['uid']?>" class="chk1" value="<?=$val['uid']?>" />
						</td>
						<td><?=$val['uid']?></td>
						<td>
							<input type="text" name="map[<?=$val['uid']?>][mode]" maxlength="100" value="<?=$val['mode']?>" onfocus="CheckboxUi.focus_to_check('#chk1_<?=$val['uid']?>');" class="inp wmatch" />
						</td>
						<td>
							<input type="text" name="map[<?=$val['uid']?>][file]" maxlength="100" value="<?=$val['file']?>" onfocus="CheckboxUi.focus_to_check('#chk1_<?=$val['uid']?>');" class="inp wmatch" />
						</td>
						<td>
							<input type="text" name="map[<?=$val['uid']?>][desc]" maxlength="100" value="<?=$val['desc']?>" onfocus="CheckboxUi.focus_to_check('#chk1_<?=$val['uid']?>');" class="inp wmatch" />
						</td>
						<td>
							<input type="radio" name="map[<?=$val['uid']?>][enable]" value="y" <?=NForm::checked($val['enable'],'y');?> id="id1_<?=$val['uid']?>" /><label for="id1_<?=$val['uid']?>" onclick="CheckboxUi.focus_to_check('#chk1_<?=$val['uid']?>');">사용</label>
							<input type="radio" name="map[<?=$val['uid']?>][enable]" value="n" id="id2_<?=$val['uid']?>" <?=NForm::checked($val['enable'],'n');?> /><label for="id2_<?=$val['uid']?>" onclick="CheckboxUi.focus_to_check('#chk1_<?=$val['uid']?>');">미사용</label>
						</td>
					</tr>
				<?php endforeach;?>
			</table>
		<?php echo NForm::close();?>
		<div class="tblt">
			<?=$pagenation1?>
		</div>
		<div class="tblh">
			체크된 엔트리 포인트를 : <span class="cbtn_s" onclick="$('#formx_list').submit();">수정</span>&nbsp;
		</div>
		<br />


		<h4>엔트리 포인트 추가</h4>
		<?php echo NForm::open(NULL, FALSE, "create");?>
			<?php echo NForm::mode('create')?>
			<table class="tbl" border="0" cellpadding="0" cellspacing="0">
				<colgroup>
					<col width="*" />
					<col width="*" />
					<col width="*" />
					<col width="140" />
				</colgroup>
				<tr>
					<th>엔트리 포인트 이름</th>
					<th>리디렉션 할 파일 및 파라미터</th>
					<th>설명</th>
					<th>사용여부</th>
					<th>명령</th>
				</tr>
				<tr>
					<td>
						<input type="text" name="map[mode]" maxlength="100" value="" class="inp wmatch" onfocus="$(this).alphanumeric({allow:'_'})" />
					</td>
					<td>
						<input type="text" name="map[file]" maxlength="100" value="" class="inp wmatch" onfocus="$(this).alphanumeric({allow:'_.?'})" />
					</td>
					<td>
						<input type="text" name="map[desc]" maxlength="100" value="" class="inp wmatch" />
					</td>
					<td>
						<input type="radio" name="map[enable]" value="y" checked="checked" id="id3" /><label for="id3" >사용</label>
						<input type="radio" name="map[enable]" value="n" id="id4" /><label for="id4" >미사용</label>
					</td>
					<td>
						<span class="cbtn_s" onclick="$('#formx_create').submit();">등록</span>
					</td>
			</table>
		<?php echo NForm::close();?>



<?php
	# HTML END
	echo $tplt->tiles_admin_footer();
	echo $tplt->page_destruct_javascript();
	include_once( '../endproc.php' );
	echo $html->html_footer();
?>
